package cn.rkylin.oms.aftersale.sysrefund.utils.downloadecrefund.impl;

import cn.rkylin.apollo.common.util.HttpUtils;
import cn.rkylin.oms.aftersale.sysrefund.utils.downloadecrefund.EcRefundDownloader;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.Map;

@Service("kaolaEcRefundDownloader")
public class KaolaDownloader implements EcRefundDownloader {
	@Value("${gateway}")
	private String gateway;

	@Override
	public JSONObject doDownloadEcRefund(Map requestParam) throws Exception {
		String url = gateway + "/microservice-kaola/refund/downloadKaolaRefundByEcRefundCode.action";

        Iterator<String> iterator = requestParam.keySet().iterator();
        String tempString = "shopId="+requestParam.get("shopId").toString()+"&ecRefundCode="+requestParam.get("value").toString();
        String resJson = HttpUtils.sendByGet(url, tempString);
        return JSON.parseObject(resJson);
	}

}
